package 选课2;


import java.util.List;

import 选课2.Course;
import 选课2.Student;
import 选课2.Teacher;

public class Main {
    public static void main(String[] args) {
        Teacher teacher1 = new Teacher("赵老师", 001, "男");
        Teacher teacher2 = new Teacher("白老师", 002, "女");

        // 赵老师添加 课程1和课程2
        Course course1 = teacher1.addCourse(1, "数学", "A111", "8:00");
        Course course2 = teacher1.addCourse(2, "语文", "A222", "10:00");

        // 白老师添加 课程3
        Course course3 = teacher2.addCourse(3, "HTML", "A101", "14:00");

        // 实例化 学生1和学生2
        Student student1 = new Student("李华", 20201001, "男");
        Student student2 = new Student("张二", 20201002, "女");

        // 学生1选课 课程1和课程2
        student1.selectCourse(course1);
        student1.selectCourse(course2);
        student2.selectCourse(course3);

        List<Course> courseList1 = student1.getCourseList();
        System.out.println("学生1【选课】【课程1和课程2】课程信息:");
        for (int i = 0; i < courseList1.size(); i++) {
            Course course = courseList1.get(i);
            System.out.println(
                    (i + 1) + ".课程名称:" + course.getClassname() + ",教室：" + course.getSpot() + ",时间：" + course.getTime());
        }

        List<Course> courseList2 = student2.getCourseList();
        System.out.println("学生2【选课】【课程3】课程信息:");
        for (int i = 0; i < courseList2.size(); i++) {
            Course course = courseList2.get(i);
            System.out.println("课程名称:" + course.getClassname() + ",教室：" + course.getSpot() + ",时间：" + course.getTime());
        }

        // 学生1退课 课程1
        student1.unSelectCourse(course1);
        System.out.println("学生1【退课】【课程1】后课程信息:");
        for (int i = 0; i < courseList1.size(); i++) {
            System.out.println(courseList1.get(i).getClassname());
        }

    }
}
